% Chakram is a subproject of Hexena - Haskell Executable Analyser
% License:			GPL-3
% Maintainer:		Montez Fitzpatrick
% Stability:		Experimental
% Portability:		GHC
% Module:			Hexena.Data.CertificateDirectory

\begin{code}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module Hexena.Data.CertificateDirectory
	(
	-- * Data Structures
	  CertificateDirectory(..)
	, CertificateAddrEntry(..)
	, CertificateDataEntry(..)
	) where

import Data.Word
import Data.Label -- Needs 'fclabels' package

data CertificateDirectory = CertificateDirectory 
	{ _certificates :: [(CertificateAttrEntry, CertificateDataEntry)] } deriving (Show, Eq, Ord)

data CertificateAttrEntry = CertificateAttrEntry
	{ _certLength :: Word32			-- Specifies the length of Certificate (Does not include octaword padding)
	, _certRevision :: Word16		-- Certificate revision number, currently either 0x0100 | 0x0200
	, _certType :: Word16			-- Specifies content type for certificate
	} deriving (Show, Eq, Ord)

data CertificateDataEntry = 
	CertificateDataEntry { _certificate :: ByteString } deriving (Show, Eq, Ord) -- Contains certificate

-- | Automatically derive a lens for the CertificateDirectory data type, which
--   provides getters and setters for that data type.
mkLabels [''CertificateDirectory, ''CertificateAttrEntry, ''CertificateDataEntry]

\end{code}
